﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ARS.Control.Custom.Entity.Fields;
using ARS.Control.Custom.Entity.Forms;
using ARS.Control.Custom.Entity.Model;
using ARS.Fields;
using Fund.Fields;

namespace NetWebControl.ControlTest.MySqlFund
{
    public partial class addchoise : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            this.EntityModifyPanel1.Entity = new fundinfo();
            this.EntityModifyPanel1.RequestKey = "Id";
            this.EntityModifyPanel1.IsEncryptKey = false;
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            this.EntityModifyPanel1.EntityToDbAfterEvent+=EntityModifyPanel1_EntityToDbAfterEvent;
            this.EntityModifyPanel1.AddOrUpdateEntityToDb();
        }

        private void EntityModifyPanel1_EntityToDbAfterEvent(List<Field> list, int newid)
        {

            ChoicesDialogField field = (ChoicesDialogField)list.Single(f => f.Db_Field_Name == "Perm");
            ChoicesDialogForm form = (ChoicesDialogForm) field.Widget;
            form.SaveData(this.EntityModifyPanel1,1);
        }
    }


}